<script setup>
import { getQueryString } from "@/utils/common";

const appid = "wxdf48c27f2d58324d";

const getWechatCode = () => {
  const url = window.location.href;
  const urlArr = url.split("?");
  const groupId = getQueryString("groupId", urlArr[1]);
  const giftGrantConfigId = getQueryString("giftGrantConfigId", urlArr[1]);
  const local = encodeURIComponent(
    `https://pdd.bkd.fit/#/currentCallback?type=0&groupId=${groupId}&giftGrantConfigId=${giftGrantConfigId}`
  );
  window.location.href =
    "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" +
    appid +
    "&redirect_uri=" +
    local +
    "&response_type=code&scope=snsapi_base&connect_redirect=1#wechat_redirect";
};

getWechatCode();
</script>
